home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 July: Mac OS SDK / Dev.CD Jul 99 SDK1.toast / Development Kits / Mac OS / Interfaces&Libraries / Universal / Interfaces / AIncludes / OSA.a < prev    next >
Encoding:
Text File  |  1998-08-17  |  57.5 KB  |  1,830 lines  |  [TEXT/MPS ]

  1. ;
  2. ;    File:        OSA.a
  3. ;
  4. ;    Contains:    AppleScript Client Interfaces.
  5. ;
  6. ;    Version:    Technology:    AppleScript 1.1
  7. ;                Release:    Universal Interfaces 3.2
  8. ;
  9. ;    Copyright:    © 1992-1998 by Apple Computer, Inc., all rights reserved
  10. ;
  11. ;    Bugs?:        For bug reports, consult the following page on
  12. ;                the World Wide Web:
  13. ;
  14. ;                    http://developer.apple.com/bugreporter/
  15. ;
  16. ;
  17.     IF &TYPE('__OSA__') = 'UNDEFINED' THEN
  18. __OSA__ SET 1
  19.  
  20.     IF &TYPE('__ERRORS__') = 'UNDEFINED' THEN
  21.     include 'Errors.a'
  22.     ENDIF
  23.     IF &TYPE('__APPLEEVENTS__') = 'UNDEFINED' THEN
  24.     include 'AppleEvents.a'
  25.     ENDIF
  26.     IF &TYPE('__AEOBJECTS__') = 'UNDEFINED' THEN
  27.     include 'AEObjects.a'
  28.     ENDIF
  29.     IF &TYPE('__COMPONENTS__') = 'UNDEFINED' THEN
  30.     include 'Components.a'
  31.     ENDIF
  32.  
  33. ; **************************************************************************
  34. ;    Types and Constants
  35. ;*************************************************************************
  36.  
  37.  
  38. ;     The componenent manager type code for components that
  39. ;        support the OSA interface defined here. 
  40. ;  0x6f736120 
  41.  
  42. kOSAComponentType                EQU        'osa '
  43. ;  0x73637074 
  44.  
  45. kOSAGenericScriptingComponentSubtype EQU 'scpt'
  46. ;     Type of script document files.    
  47. ;  0x6f736173 
  48.  
  49. kOSAFileType                    EQU        'osas'
  50. ;        Suite and event code of the RecordedText event. 
  51. ;        (See OSAStartRecording, below.)
  52. ;    
  53.  
  54. ;  0x61736372 
  55.  
  56. kOSASuite                        EQU        'ascr'
  57. ;  0x72656364 
  58.  
  59. kOSARecordedText                EQU        'recd'
  60. ;  Selector returns boolean 
  61. ;  0x6d6f6469 
  62.  
  63. kOSAScriptIsModified            EQU        'modi'
  64. ;  Selector returns boolean 
  65. ;  0x63736372 
  66.  
  67. kOSAScriptIsTypeCompiledScript    EQU        'cscr'
  68. ;  Selector returns boolean 
  69. ;  0x76616c75 
  70.  
  71. kOSAScriptIsTypeScriptValue        EQU        'valu'
  72. ;  Selector returns boolean 
  73. ;  0x636e7478 
  74.  
  75. kOSAScriptIsTypeScriptContext    EQU        'cntx'
  76. ;  Selector returns a DescType which may be passed to OSACoerceToDesc 
  77. ;  0x62657374 
  78.  
  79. kOSAScriptBestType                EQU        'best'
  80. ;        This selector is used to determine whether a script has source 
  81. ;        associated with it that when given to OSAGetSource, the call will not
  82. ;        fail.  The selector returns a boolean.
  83. ;    
  84.  
  85. ;  0x67737263 
  86.  
  87. kOSACanGetSource                EQU        'gsrc'
  88.  
  89.  
  90. typeOSADialectInfo                EQU        'difo'                ;  0x6469666f   
  91. keyOSADialectName                EQU        'dnam'                ;  0x646e616d   
  92. keyOSADialectCode                EQU        'dcod'                ;  0x64636f64   
  93. keyOSADialectLangCode            EQU        'dlcd'                ;  0x646c6364   
  94. keyOSADialectScriptCode            EQU        'dscd'                ;  0x64736364   
  95. ; typedef ComponentResult                 OSAError
  96.  
  97. ;  Under the Open Scripting Architecture all error results are longs 
  98. ; typedef unsigned long                 OSAID
  99.  
  100. ;        OSAIDs allow transparent manipulation of scripts associated with
  101. ;         various scripting systems.
  102. ;    
  103.  
  104.  
  105. kOSANullScript                    EQU        0
  106. ;  No -script constant. 
  107.  
  108. kOSANullMode                    EQU        0                    ; sounds better 
  109. kOSAModeNull                    EQU        0                    ; tastes consistent 
  110. ;        Some routines take flags that control their execution.  This constant
  111. ;        declares default mode settings are used.
  112. ;    
  113.  
  114. ; **************************************************************************
  115. ;    Standard Script Errors
  116. ;**************************************************************************
  117. ;    It is recommended that scripting components use the following set of error
  118. ;    codes to signal failure when applicable.  This enables applications that
  119. ;    use the OSA API to deal with some class of script errors in a less than 
  120. ;    ad hoc manner.  Scripting components are of course encouraged to return
  121. ;    component-specific errors when these don't apply.
  122. ;*************************************************************************
  123.  
  124. ;         Dynamic errors:
  125. ;
  126. ;    These errors result from data-dependent conditions and are typically
  127. ;    signaled at runtime.
  128. ;
  129.  
  130. ;        Signaled when a value can't be coerced to the desired type. Similar
  131. ;          to errOSATypeError except results from coercion.
  132. ;    
  133.  
  134.  
  135. errOSACantCoerce                EQU        -1700
  136. ;  Signaled when an object is not found in a container 
  137.  
  138. errOSACantAccess                EQU        -1728
  139. ;        Signaled when an object cannot be set in a container.  Same as 
  140. ;          AERegistry error errAEWriteDenied.
  141. ;    
  142.  
  143.  
  144. errOSACantAssign                EQU        -10006
  145. ;        Signaled by user scripts or applications when no actual error code
  146. ;          is to be returned.  Simply means "an error has occurred".  Most useful
  147. ;          in conjunction with an error message from the application.
  148. ;    
  149.  
  150.  
  151. errOSAGeneralError                EQU        -2700
  152. ;  Signaled when there is an attempt to divide by zero 
  153.  
  154. errOSADivideByZero                EQU        -2701
  155. ;  Signaled when integer or real value is too large to be represented 
  156.  
  157. errOSANumericOverflow            EQU        -2702
  158. ;        Signaled when application can't be launched or when it is remote and
  159. ;          program linking is not enabled.
  160. ;    
  161.  
  162.  
  163. errOSACantLaunch                EQU        -2703
  164. ;  Signaled when an application can't respond to AppleEvents 
  165.  
  166. errOSAAppNotHighLevelEventAware    EQU        -2704
  167. ;  Signaled when an application's terminology resource is not readable 
  168.  
  169. errOSACorruptTerminology        EQU        -2705
  170. ;  Signaled when the runtime stack overflows 
  171.  
  172. errOSAStackOverflow                EQU        -2706
  173. ;  Signaled when a runtime internal data structure overflows 
  174.  
  175. errOSAInternalTableOverflow        EQU        -2707
  176. ;        Signaled when an intrinsic limitation is exceeded for the size of 
  177. ;          a value or data structure.
  178. ;    
  179.  
  180.  
  181. errOSADataBlockTooLarge            EQU        -2708
  182.  
  183. errOSACantGetTerminology        EQU        -2709
  184.  
  185. errOSACantCreate                EQU        -2710
  186. ;         Component-specific dynamic script errors:
  187. ;
  188. ;    The range -2720 thru -2739 is reserved for component-specific runtime errors.
  189. ;    (Note that error codes from different scripting components in this range will
  190. ;    overlap.)
  191. ;
  192.  
  193. ;         Static errors:
  194. ;
  195. ;    These errors comprise what are commonly thought of as parse and compile-
  196. ;    time errors.  However, in a dynamic system (e.g. AppleScript) any or all
  197. ;    of these may also occur at runtime.
  198. ;
  199.  
  200.  
  201. ;  Signaled when data was not the right type and coercion is not allowed 
  202.  
  203. errOSATypeError                    EQU        -1703
  204. ;  Signaled when a message was sent to an object that didn't handle it 
  205.  
  206. OSAMessageNotUnderstood            EQU        -1708
  207. ;        Signaled when a function to be returned doesn't exist.  (Probably only
  208. ;          useful in languages with first-class functions that distinguish between
  209. ;          functions and other values (two name spaces). This is different from
  210. ;          errOSAMessageNotUnderstood, which may be signaled when the method is
  211. ;          invoked.
  212. ;    
  213.  
  214.  
  215. OSAUndefinedHandler                EQU        -1717
  216. ;  Signaled when a container can never have the requested object 
  217.  
  218. OSAIllegalAccess                EQU        -1723
  219. ;  Signaled when index was out of range. Specialization of errOSACantAccess. 
  220.  
  221. OSAIllegalIndex                    EQU        -1719
  222. ;  Signaled when a range is screwy. Specialization of errOSACantAccess. 
  223.  
  224. OSAIllegalRange                    EQU        -1720
  225. ;        Signaled when an object can never be set in a container.  Same as 
  226. ;          AERegistry error errAENotModifiable.
  227. ;    
  228.  
  229.  
  230. OSAIllegalAssign                EQU        -10003
  231. ;        Signaled when a syntax error occurs. (e.g. "Syntax error" or
  232. ;         "<this> can't go after <that>").
  233. ;    
  234.  
  235.  
  236. OSASyntaxError                    EQU        -2740
  237. ;        Signaled when another form of syntax was expected. (e.g. "expected
  238. ;          a <type> but found <this>").
  239. ;    
  240.  
  241.  
  242. OSASyntaxTypeError                EQU        -2741
  243. ;  Signaled when a name or number is too long to be parsed 
  244.  
  245. OSATokenTooLong                    EQU        -2742
  246. ;        Signaled when a parameter is missing for a function invocation.  Note
  247. ;          that in some languages, this error may occur at runtime.
  248. ;    
  249.  
  250.  
  251. OSAMissingParameter                EQU        -1701
  252. ;        Signaled when function is called with the wrong number of parameters,
  253. ;          or a parameter pattern cannot be matched.
  254. ;    
  255.  
  256.  
  257. OSAParameterMismatch            EQU        -1721
  258. ;        Signaled when a formal parameter, local variable, or instance variable
  259. ;          is specified more than once.
  260. ;    
  261.  
  262.  
  263. OSADuplicateParameter            EQU        -2750
  264. ;        Signaled when a formal parameter, local variable, or instance variable
  265. ;          is specified more than once.
  266. ;    
  267.  
  268.  
  269. OSADuplicateProperty            EQU        -2751
  270. ;        Signaled when more than one handler is defined with the same name in 
  271. ;          a scope where the language doesn't allow it.
  272. ;    
  273.  
  274.  
  275. OSADuplicateHandler                EQU        -2752
  276. ;  Signaled when a variable is accessed that has no value 
  277.  
  278. OSAUndefinedVariable            EQU        -2753
  279. ;        Signaled when a variable is declared inconsistently in the same scope,
  280. ;          such as both local and global.
  281. ;    
  282.  
  283.  
  284. OSAInconsistentDeclarations        EQU        -2754
  285. ;        Signaled when illegal control flow occurs in an application (no catcher
  286. ;          for throw, non-lexical loop exit, etc.).
  287. ;    
  288.  
  289.  
  290. OSAControlFlowError                EQU        -2755
  291. ;         Component-specific static script errors:
  292. ;
  293. ;    The range -2760 thru -2779 is reserved for component-specific parsing and
  294. ;    compile-time errors. (Note that error codes from different scripting
  295. ;    components in this range will overlap.)
  296. ;
  297.  
  298. ;         Dialect-specific script errors:
  299. ;
  300. ;    The range -2780 thru -2799 is reserved for dialect specific error codes for
  301. ;    scripting components that support dialects. (Note that error codes from
  302. ;    different scripting components in this range will overlap, as well as error
  303. ;    codes from different dialects in the same scripting component.)
  304. ;
  305.  
  306. ; **************************************************************************
  307. ;    OSA Interface Descriptions
  308. ;**************************************************************************
  309. ;    The OSA Interface is broken down into a required interface, and several
  310. ;    optional interfaces to support additional functionality.  A given scripting
  311. ;    component may choose to support only some of the optional interfaces in
  312. ;    addition to the basic interface.  The OSA Component Flags may be used to 
  313. ;    query the Component Manager to find a scripting component with a particular
  314. ;    capability, or determine if a particular scripting component supports a 
  315. ;    particular capability.
  316. ;*************************************************************************
  317.  
  318. ;  OSA Component Flags: 
  319.  
  320. kOSASupportsCompiling            EQU        $0002
  321. kOSASupportsGetSource            EQU        $0004
  322. kOSASupportsAECoercion            EQU        $0008
  323. kOSASupportsAESending            EQU        $0010
  324. kOSASupportsRecording            EQU        $0020
  325. kOSASupportsConvenience            EQU        $0040
  326. kOSASupportsDialects            EQU        $0080
  327. kOSASupportsEventHandling        EQU        $0100
  328. ;  Component Selectors: 
  329.  
  330. kOSASelectLoad                    EQU        $0001
  331. kOSASelectStore                    EQU        $0002
  332. kOSASelectExecute                EQU        $0003
  333. kOSASelectDisplay                EQU        $0004
  334. kOSASelectScriptError            EQU        $0005
  335. kOSASelectDispose                EQU        $0006
  336. kOSASelectSetScriptInfo            EQU        $0007
  337. kOSASelectGetScriptInfo            EQU        $0008
  338. kOSASelectSetActiveProc            EQU        $0009
  339. kOSASelectGetActiveProc            EQU        $000A
  340. ;  Compiling: 
  341.  
  342. kOSASelectScriptingComponentName EQU    $0102
  343. kOSASelectCompile                EQU        $0103
  344. kOSASelectCopyID                EQU        $0104
  345. ;  GetSource: 
  346.  
  347. kOSASelectGetSource                EQU        $0201
  348. ;  AECoercion: 
  349.  
  350. kOSASelectCoerceFromDesc        EQU        $0301
  351. kOSASelectCoerceToDesc            EQU        $0302
  352. ;  AESending: 
  353.  
  354. kOSASelectSetSendProc            EQU        $0401
  355. kOSASelectGetSendProc            EQU        $0402
  356. kOSASelectSetCreateProc            EQU        $0403
  357. kOSASelectGetCreateProc            EQU        $0404
  358. kOSASelectSetDefaultTarget        EQU        $0405
  359. ;  Recording: 
  360.  
  361. kOSASelectStartRecording        EQU        $0501
  362. kOSASelectStopRecording            EQU        $0502
  363. ;  Convenience: 
  364.  
  365. kOSASelectLoadExecute            EQU        $0601
  366. kOSASelectCompileExecute        EQU        $0602
  367. kOSASelectDoScript                EQU        $0603
  368. ;  Dialects: 
  369.  
  370. kOSASelectSetCurrentDialect        EQU        $0701
  371. kOSASelectGetCurrentDialect        EQU        $0702
  372. kOSASelectAvailableDialects        EQU        $0703
  373. kOSASelectGetDialectInfo        EQU        $0704
  374. kOSASelectAvailableDialectCodeList EQU    $0705
  375. ;  Event Handling: 
  376.  
  377. kOSASelectSetResumeDispatchProc    EQU        $0801
  378. kOSASelectGetResumeDispatchProc    EQU        $0802
  379. kOSASelectExecuteEvent            EQU        $0803
  380. kOSASelectDoEvent                EQU        $0804
  381. kOSASelectMakeContext            EQU        $0805
  382.  
  383. ;  scripting component specific selectors are added beginning with this value  
  384.  
  385. kOSASelectComponentSpecificStart EQU    $1001
  386.  
  387. ;         Mode Flags:
  388. ;
  389. ;    Warning: These should not conflict with the AESend mode flags in
  390. ;    AppleEvents.h, because we may want to use them as OSA mode flags too.
  391. ;
  392.  
  393.  
  394. ;        This mode flag may be passed to OSALoad, OSAStore or OSACompile to
  395. ;          instruct the scripting component to not retain the "source" of an
  396. ;          expression.  This will cause the OSAGetSource call to return the error
  397. ;          errOSASourceNotAvailable if used.  However, some scripting components
  398. ;          may not retain the source anyway.  This is mainly used when either space
  399. ;          efficiency is desired, or a script is to be "locked" so that its
  400. ;          implementation may not be viewed.
  401. ;    
  402.  
  403.  
  404. kOSAModePreventGetSource        EQU        $00000001
  405. ;        These mode flags may be passed to OSACompile, OSAExecute, OSALoadExecute
  406. ;          OSACompileExecute, OSADoScript, OSAExecuteEvent, or OSADoEvent to
  407. ;          indicate whether or not the script may interact with the user, switch
  408. ;          layer or reconnect if necessary.  Any AppleEvents will be sent with the
  409. ;          corresponding AESend mode supplied.
  410. ;    
  411.  
  412.  
  413. kOSAModeNeverInteract            EQU        $00000010
  414. kOSAModeCanInteract                EQU        $00000020
  415. kOSAModeAlwaysInteract            EQU        $00000030
  416. kOSAModeDontReconnect            EQU        $00000080
  417. ;        This mode flag may be passed to OSACompile, OSAExecute, OSALoadExecute
  418. ;          OSACompileExecute, OSADoScript, OSAExecuteEvent, or OSADoEvent to
  419. ;          indicate whether or not AppleEvents should be sent with the
  420. ;          kAECanSwitchLayer mode flag sent or not. NOTE: This flag is exactly the
  421. ;          opposite sense of the AppleEvent flag kAECanSwitchLayer.  This is to
  422. ;          provide a more convenient default, i.e. not supplying any mode
  423. ;          (kOSAModeNull) means to send events with kAECanSwitchLayer.  Supplying
  424. ;          the kOSAModeCantSwitchLayer mode flag will cause AESend to be called
  425. ;          without kAECanSwitchLayer.
  426. ;    
  427.  
  428.  
  429. kOSAModeCantSwitchLayer            EQU        $00000040
  430. ;        This mode flag may be passed to OSACompile, OSAExecute, OSALoadExecute
  431. ;          OSACompileExecute, OSADoScript, OSAExecuteEvent, or OSADoEvent to
  432. ;          indicate whether or not AppleEvents should be sent with the kAEDontRecord
  433. ;          mode flag sent or not. NOTE: This flag is exactly the opposite sense of
  434. ;          the AppleEvent flag kAEDontRecord.  This is to provide a more convenient
  435. ;          default, i.e. not supplying any mode (kOSAModeNull) means to send events
  436. ;          with kAEDontRecord.  Supplying the kOSAModeDoRecord mode flag will 
  437. ;          cause AESend to be called without kAEDontRecord.
  438. ;    
  439.  
  440.  
  441. kOSAModeDoRecord                EQU        $00001000
  442. ;        This is a mode flag for OSACompile that indicates that a context should
  443. ;          be created as the result of compilation. All handler definitions are
  444. ;          inserted into the new context, and variables are initialized by
  445. ;          evaluating their initial values in a null context (i.e. they must be
  446. ;          constant expressions).
  447. ;    
  448.  
  449.  
  450. kOSAModeCompileIntoContext        EQU        $00000002
  451. ;        This is a mode flag for OSACompile that indicates that the previous
  452. ;          script ID (input to OSACompile) should be augmented with any new
  453. ;          definitions in the sourceData rather than replaced with a new script.
  454. ;          This means that the previous script ID must designate a context.
  455. ;          The presence of this flag causes the kOSAModeCompileIntoContext flag
  456. ;          to be implicitly used, causing any new definitions to be initialized
  457. ;          in a null context.
  458. ;    
  459.  
  460.  
  461. kOSAModeAugmentContext            EQU        $00000004
  462. ;        This mode flag may be passed to OSADisplay or OSADoScript to indicate
  463. ;          that output only need be human-readable, not re-compilable by OSACompile.
  464. ;          If used, output may be arbitrarily "beautified", e.g. quotes may be left
  465. ;          off of string values, long lists may have elipses, etc.
  466. ;    
  467.  
  468.  
  469. kOSAModeDisplayForHumans        EQU        $00000008
  470. ;        This mode flag may be passed to OSAStore in the case where the scriptID
  471. ;          is a context.  This causes the context to be saved, but not the context's
  472. ;          parent context.  When the stored context is loaded back in, the parent
  473. ;          will be kOSANullScript.
  474. ;    
  475.  
  476.  
  477. kOSAModeDontStoreParent            EQU        $00010000
  478. ;        This mode flag may be passed to OSAExecuteEvent to cause the event to
  479. ;          be dispatched to the direct object of the event. The direct object (or
  480. ;          subject attribute if the direct object is a non-object specifier) will
  481. ;          be resolved, and the resulting script object will be the recipient of
  482. ;          the message. The context argument to OSAExecuteEvent will serve as the
  483. ;          root of the lookup/resolution process.
  484. ;    
  485.  
  486.  
  487. kOSAModeDispatchToDirectObject    EQU        $00020000
  488. ;        This mode flag may be passed to OSAExecuteEvent to indicate that
  489. ;          components do not have to get the data of object specifier arguments.
  490. ;    
  491.  
  492.  
  493. kOSAModeDontGetDataForArguments    EQU        $00040000
  494. ; **************************************************************************
  495. ;    OSA Basic Scripting Interface
  496. ;**************************************************************************
  497. ;    Scripting components must at least support the Basic Scripting interface.
  498. ;*************************************************************************
  499.  
  500. ;         Loading and Storing Scripts:
  501. ;
  502. ;    These routines allow scripts to be loaded and stored in their internal
  503. ;    (possibly compiled, non-text) representation.
  504. ;
  505.  
  506.  
  507. ;  Resource type for scripts 
  508.  
  509. kOSAScriptResourceType            EQU        'scpt'
  510. ;        Default type given to OSAStore which creates "generic" loadable script
  511. ;          data descriptors.
  512. ;    
  513.  
  514.  
  515. typeOSAGenericStorage            EQU        'scpt'
  516. ;
  517. ; pascal OSAError OSALoad(ComponentInstance scriptingComponent, const AEDesc *scriptData, long modeFlags, OSAID *resultingScriptID)
  518. ;
  519.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  520.         Macro
  521.         _OSALoad
  522.             move.l              #$000C0001,-(sp)
  523.             moveq               #0,D0
  524.             dc.w                $A82A
  525.         EndM
  526.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  527.         IMPORT_CFM_FUNCTION OSALoad
  528.     ENDIF
  529.  
  530. ;        OSAComponentFunctionInline(kOSASelectLoad, 12);
  531. ;    
  532. ;        Errors:
  533. ;            badComponentInstance        invalid scripting component instance
  534. ;            errOSASystemError
  535. ;            errOSABadStorageType:        scriptData not for this scripting component
  536. ;            errOSACorruptData:            data seems to be corrupt
  537. ;            errOSADataFormatObsolete    script data format is no longer supported
  538. ;            errOSADataFormatTooNew        script data format is from a newer version
  539. ;        
  540. ;        ModeFlags:
  541. ;            kOSAModePreventGetSource
  542. ;    
  543.  
  544. ;
  545. ; pascal OSAError OSAStore(ComponentInstance scriptingComponent, OSAID scriptID, DescType desiredType, long modeFlags, AEDesc *resultingScriptData)
  546. ;
  547.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  548.         Macro
  549.         _OSAStore
  550.             move.l              #$00100002,-(sp)
  551.             moveq               #0,D0
  552.             dc.w                $A82A
  553.         EndM
  554.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  555.         IMPORT_CFM_FUNCTION OSAStore
  556.     ENDIF
  557.  
  558. ;        OSAComponentFunctionInline(kOSASelectStore, 16);
  559. ;    
  560. ;        Errors:
  561. ;            badComponentInstance    invalid scripting component instance
  562. ;            errOSASystemError
  563. ;            errOSAInvalidID
  564. ;            errOSABadStorageType:    desiredType not for this scripting component
  565. ;        
  566. ;        ModeFlags:
  567. ;            kOSAModePreventGetSource
  568. ;            kOSAModeDontStoreParent
  569. ;    
  570.  
  571. ;  Executing Scripts: 
  572. ;
  573. ; pascal OSAError OSAExecute(ComponentInstance scriptingComponent, OSAID compiledScriptID, OSAID contextID, long modeFlags, OSAID *resultingScriptValueID)
  574. ;
  575.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  576.         Macro
  577.         _OSAExecute
  578.             move.l              #$00100003,-(sp)
  579.             moveq               #0,D0
  580.             dc.w                $A82A
  581.         EndM
  582.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  583.         IMPORT_CFM_FUNCTION OSAExecute
  584.     ENDIF
  585.  
  586. ;        OSAComponentFunctionInline(kOSASelectExecute, 16);
  587. ;        This call runs a script.  The contextID represents the environment
  588. ;        with which global variables in the script are resolved.  The constant
  589. ;        kOSANullScript may be used for the contextID if the application wishes
  590. ;        to not deal with context directly (a default one is associated with each
  591. ;        scripting component instance).  The resultingScriptValueID is the 
  592. ;        result of evaluation, and contains a value which may be displayed using
  593. ;        the OSAGetSource call.  The modeFlags convey scripting component
  594. ;        specific information.
  595. ;    
  596. ;        Errors:
  597. ;            badComponentInstance    invalid scripting component instance
  598. ;            errOSASystemError
  599. ;            errOSAInvalidID
  600. ;            errOSAScriptError:        the executing script got an error
  601. ;    
  602. ;        ModeFlags:
  603. ;            kOSAModeNeverInteract
  604. ;            kOSAModeCanInteract
  605. ;            kOSAModeAlwaysInteract
  606. ;            kOSAModeCantSwitchLayer
  607. ;            kOSAModeDontReconnect
  608. ;            kOSAModeDoRecord
  609. ;    
  610.  
  611. ;  Displaying results: 
  612. ;
  613. ; pascal OSAError OSADisplay(ComponentInstance scriptingComponent, OSAID scriptValueID, DescType desiredType, long modeFlags, AEDesc *resultingText)
  614. ;
  615.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  616.         Macro
  617.         _OSADisplay
  618.             move.l              #$00100004,-(sp)
  619.             moveq               #0,D0
  620.             dc.w                $A82A
  621.         EndM
  622.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  623.         IMPORT_CFM_FUNCTION OSADisplay
  624.     ENDIF
  625.  
  626. ;        OSAComponentFunctionInline(kOSASelectDisplay, 16);
  627. ;        This call is used to convert results (script value IDs) into displayable
  628. ;        text. The desiredType should be at least typeChar, and modeFlags are
  629. ;        scripting system specific flags to control the formatting of the
  630. ;        resulting text. This call differs from OSAGetSource in that (1) it
  631. ;        always produces at least typeChar, (2) is only works on script values,
  632. ;        (3) it may display it's output in non-compilable form (e.g. without
  633. ;        string quotes, elipses inserted in long and/or circular lists, etc.) and
  634. ;        (4) it is required by the basic scripting interface.
  635. ;    
  636. ;        Errors:
  637. ;            badComponentInstance    invalid scripting component instance
  638. ;            errOSASystemError
  639. ;            errOSAInvalidID
  640. ;            errAECoercionFail:        desiredType not supported by scripting component
  641. ;    
  642. ;        ModeFlags:
  643. ;            kOSAModeDisplayForHumans
  644. ;    
  645.  
  646. ;  Getting Error Information: 
  647. ;
  648. ; pascal OSAError OSAScriptError(ComponentInstance scriptingComponent, OSType selector, DescType desiredType, AEDesc *resultingErrorDescription)
  649. ;
  650.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  651.         Macro
  652.         _OSAScriptError
  653.             move.l              #$000C0005,-(sp)
  654.             moveq               #0,D0
  655.             dc.w                $A82A
  656.         EndM
  657.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  658.         IMPORT_CFM_FUNCTION OSAScriptError
  659.     ENDIF
  660.  
  661. ;        OSAComponentFunctionInline(kOSASelectScriptError, 12);
  662. ;        Whenever script execution returns errOSAExecutionError, this routine
  663. ;        may be used to get information about that error.  The selector describes
  664. ;        the type of information desired about the error (various selectors are
  665. ;        listed below).  The desiredType indicates the data type of the result
  666. ;        desired for that selector.
  667. ;    
  668. ;        Errors:
  669. ;            badComponentInstance    invalid scripting component instance
  670. ;            errOSASystemError
  671. ;            errOSABadSelector:        selector not supported by scripting component
  672. ;            errAECoercionFail:        desiredType not supported by scripting component
  673. ;    
  674.  
  675. ;  OSAScriptError selectors: 
  676. ;        This selector is used to determine the error number of a script error.
  677. ;        These error numbers may be either system error numbers, or error numbers
  678. ;        that are scripting component specific.
  679. ;        Required desiredTypes:    
  680. ;              typeShortInteger
  681. ;    
  682.  
  683.  
  684. kOSAErrorNumber                    EQU        'errn'
  685. ;        This selector is used to determine the full error message associated
  686. ;        with the error number.  It should include the name of the application
  687. ;        which caused the error, as well as the specific error that occurred.
  688. ;        This selector is sufficient for simple error reporting (but see
  689. ;        kOSAErrorBriefMessage, below).
  690. ;        Required desiredTypes:
  691. ;            typeChar                    error message string
  692. ;    
  693.  
  694.  
  695. kOSAErrorMessage                EQU        'errs'
  696. ;        This selector is used to determine a brief error message associated with
  697. ;        the error number.  This message and should not mention the name of the
  698. ;        application which caused the error, any partial results or offending
  699. ;        object (see kOSAErrorApp, kOSAErrorPartialResult and
  700. ;        kOSAErrorOffendingObject, below).
  701. ;        Required desiredTypes:
  702. ;              typeChar                    brief error message string
  703. ;    
  704.  
  705. ;   0x65727262  
  706.  
  707. kOSAErrorBriefMessage            EQU        'errb'
  708. ;        This selector is used to determine which application actually got the
  709. ;        error (if it was the result of an AESend), or the current application
  710. ;        if ....
  711. ;        Required desiredTypes:
  712. ;              typeProcessSerialNumber        PSN of the errant application
  713. ;              typeChar                    name of the errant application
  714. ;    
  715.  
  716. ;   0x65726170  
  717.  
  718. kOSAErrorApp                    EQU        'erap'
  719. ;        This selector is used to determine any partial result returned by an 
  720. ;        operation. If an AESend call failed, but a partial result was returned,
  721. ;        then the partial result may be returned as an AEDesc.
  722. ;        Required desiredTypes:
  723. ;              typeBest                    AEDesc of any partial result
  724. ;    
  725.  
  726. ;   0x70746c72   
  727.  
  728. kOSAErrorPartialResult            EQU        'ptlr'
  729. ;        This selector is used to determine any object which caused the error
  730. ;        that may have been indicated by an application.  The result is an 
  731. ;        AEDesc.
  732. ;        Required desiredTypes:
  733. ;              typeBest                    AEDesc of any offending object
  734. ;    
  735.  
  736. ;   0x65726f62   
  737.  
  738. kOSAErrorOffendingObject        EQU        'erob'
  739. ;        This selector is used to determine the type expected by a coercion 
  740. ;        operation if a type error occurred.
  741. ;    
  742.  
  743. ;   0x65727274   
  744.  
  745. kOSAErrorExpectedType            EQU        'errt'
  746. ;        This selector is used to determine the source text range (start and 
  747. ;        end positions) of where the error occurred.
  748. ;        Required desiredTypes:
  749. ;              typeOSAErrorRange
  750. ;    
  751.  
  752. ;   0x65726e67  
  753.  
  754. kOSAErrorRange                    EQU        'erng'
  755. ;        An AERecord type containing keyOSASourceStart and keyOSASourceEnd fields
  756. ;        of type short.
  757. ;    
  758.  
  759. ;   0x65726e67   
  760.  
  761. typeOSAErrorRange                EQU        'erng'
  762. ;  Field of a typeOSAErrorRange record of typeShortInteger 
  763. ;   0x73726373    
  764.  
  765. keyOSASourceStart                EQU        'srcs'
  766. ;  Field of a typeOSAErrorRange record of typeShortInteger 
  767. ;   0x73726365   
  768.  
  769. keyOSASourceEnd                    EQU        'srce'
  770. ;  Disposing Script IDs: 
  771. ;
  772. ; pascal OSAError OSADispose(ComponentInstance scriptingComponent, OSAID scriptID)
  773. ;
  774.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  775.         Macro
  776.         _OSADispose
  777.             move.l              #$00040006,-(sp)
  778.             moveq               #0,D0
  779.             dc.w                $A82A
  780.         EndM
  781.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  782.         IMPORT_CFM_FUNCTION OSADispose
  783.     ENDIF
  784.  
  785. ;        OSAComponentFunctionInline(kOSASelectDispose, 4);
  786. ;        Disposes a script or context.
  787. ;    
  788. ;        Errors:
  789. ;            badComponentInstance    invalid scripting component instance
  790. ;            errOSASystemError
  791. ;            errOSAInvalidID
  792. ;    
  793.  
  794. ;  Getting and Setting Script Information: 
  795. ;
  796. ; pascal OSAError OSASetScriptInfo(ComponentInstance scriptingComponent, OSAID scriptID, OSType selector, long value)
  797. ;
  798.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  799.         Macro
  800.         _OSASetScriptInfo
  801.             move.l              #$000C0007,-(sp)
  802.             moveq               #0,D0
  803.             dc.w                $A82A
  804.         EndM
  805.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  806.         IMPORT_CFM_FUNCTION OSASetScriptInfo
  807.     ENDIF
  808.  
  809. ;        OSAComponentFunctionInline(kOSASelectSetScriptInfo, 12);
  810. ;    
  811. ;        Errors:
  812. ;            badComponentInstance    invalid scripting component instance
  813. ;            errOSASystemError
  814. ;            errOSAInvalidID
  815. ;            errOSABadSelector:        selector not supported by scripting component
  816. ;                                    or selector not for this scriptID
  817. ;    
  818.  
  819. ;
  820. ; pascal OSAError OSAGetScriptInfo(ComponentInstance scriptingComponent, OSAID scriptID, OSType selector, long *result)
  821. ;
  822.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  823.         Macro
  824.         _OSAGetScriptInfo
  825.             move.l              #$000C0008,-(sp)
  826.             moveq               #0,D0
  827.             dc.w                $A82A
  828.         EndM
  829.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  830.         IMPORT_CFM_FUNCTION OSAGetScriptInfo
  831.     ENDIF
  832.  
  833. ;        OSAComponentFunctionInline(kOSASelectGetScriptInfo, 12);
  834. ;    
  835. ;        Errors:
  836. ;            badComponentInstance    invalid scripting component instance
  837. ;            errOSASystemError
  838. ;            errOSAInvalidID
  839. ;            errOSABadSelector:        selector not supported by scripting component
  840. ;                                    or selector not for this scriptID
  841. ;    
  842.  
  843. ;  Manipulating the ActiveProc:
  844. ;
  845. ;    Scripting systems will supply default values for these procedures if they
  846. ;    are not set by the client:
  847. ;
  848.  
  849. ;
  850. ; pascal OSAError OSASetActiveProc(ComponentInstance scriptingComponent, OSAActiveUPP activeProc, long refCon)
  851. ;
  852.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  853.         Macro
  854.         _OSASetActiveProc
  855.             move.l              #$00080009,-(sp)
  856.             moveq               #0,D0
  857.             dc.w                $A82A
  858.         EndM
  859.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  860.         IMPORT_CFM_FUNCTION OSASetActiveProc
  861.     ENDIF
  862.  
  863. ;        OSAComponentFunctionInline(kOSASelectSetActiveProc, 8);
  864. ;        If activeProc is nil, the default activeProc is used.
  865. ;    
  866. ;        Errors:
  867. ;            badComponentInstance    invalid scripting component instance
  868. ;            errOSASystemError
  869. ;    
  870.  
  871. ;
  872. ; pascal OSAError OSAGetActiveProc(ComponentInstance scriptingComponent, OSAActiveUPP *activeProc, long *refCon)
  873. ;
  874.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  875.         Macro
  876.         _OSAGetActiveProc
  877.             move.l              #$0008000A,-(sp)
  878.             moveq               #0,D0
  879.             dc.w                $A82A
  880.         EndM
  881.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  882.         IMPORT_CFM_FUNCTION OSAGetActiveProc
  883.     ENDIF
  884.  
  885. ;        OSAComponentFunctionInline(kOSASelectGetActiveProc, 8);
  886. ;    
  887. ;        Errors:
  888. ;            badComponentInstance    invalid scripting component instance
  889. ;            errOSASystemError
  890. ;    
  891.  
  892. ; **************************************************************************
  893. ;    OSA Optional Compiling Interface
  894. ;**************************************************************************
  895. ;    Scripting components that support the Compiling interface have the 
  896. ;    kOSASupportsCompiling bit set in it's ComponentDescription.
  897. ;*************************************************************************
  898.  
  899. ;
  900. ; pascal OSAError OSAScriptingComponentName(ComponentInstance scriptingComponent, AEDesc *resultingScriptingComponentName)
  901. ;
  902.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  903.         Macro
  904.         _OSAScriptingComponentName
  905.             move.l              #$00040102,-(sp)
  906.             moveq               #0,D0
  907.             dc.w                $A82A
  908.         EndM
  909.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  910.         IMPORT_CFM_FUNCTION OSAScriptingComponentName
  911.     ENDIF
  912.  
  913. ;        OSAComponentFunctionInline(kOSASelectScriptingComponentName, 4);
  914. ;        Given a scripting component, this routine returns the name of that
  915. ;        scripting component in a type that is coercable to text (typeChar).
  916. ;        The generic scripting component returns the name of the default
  917. ;        scripting component.  This name should be sufficient to convey to the
  918. ;        user the kind of script (syntax) he is expected to write.
  919. ;    
  920. ;        Errors:
  921. ;            badComponentInstance    invalid scripting component instance
  922. ;            errOSASystemError
  923. ;    
  924.  
  925. ;
  926. ; pascal OSAError OSACompile(ComponentInstance scriptingComponent, const AEDesc *sourceData, long modeFlags, OSAID *previousAndResultingScriptID)
  927. ;
  928.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  929.         Macro
  930.         _OSACompile
  931.             move.l              #$000C0103,-(sp)
  932.             moveq               #0,D0
  933.             dc.w                $A82A
  934.         EndM
  935.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  936.         IMPORT_CFM_FUNCTION OSACompile
  937.     ENDIF
  938.  
  939. ;        OSAComponentFunctionInline(kOSASelectCompile, 12);
  940. ;        Coerces input desc (possibly text) into a script's internal format.
  941. ;        Once compiled, the script is ready to run.  The modeFlags convey
  942. ;        scripting component specific information.  The previous script ID
  943. ;        (result parameter) is made to refer to the newly compiled script,
  944. ;        unless it was originally kOSANullScript.  In this case a new script
  945. ;        ID is created and used.
  946. ;    
  947. ;        Errors:
  948. ;            badComponentInstance    invalid scripting component instance
  949. ;            errOSASystemError
  950. ;            errAECoercionFail:        sourceData is not compilable
  951. ;            errOSAScriptError:        sourceData was a bad script (syntax error)
  952. ;            errOSAInvalidID:        previousAndResultingCompiledScriptID was not
  953. ;                                    valid on input
  954. ;    
  955. ;        ModeFlags:
  956. ;            kOSAModePreventGetSource
  957. ;            kOSAModeCompileIntoContext
  958. ;            kOSAModeAugmentContext
  959. ;            kOSAModeNeverInteract
  960. ;            kOSAModeCanInteract
  961. ;            kOSAModeAlwaysInteract
  962. ;            kOSAModeCantSwitchLayer
  963. ;            kOSAModeDontReconnect
  964. ;            kOSAModeDoRecord
  965. ;    
  966.  
  967. ;
  968. ; pascal OSAError OSACopyID(ComponentInstance scriptingComponent, OSAID fromID, OSAID *toID)
  969. ;
  970.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  971.         Macro
  972.         _OSACopyID
  973.             move.l              #$00080104,-(sp)
  974.             moveq               #0,D0
  975.             dc.w                $A82A
  976.         EndM
  977.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  978.         IMPORT_CFM_FUNCTION OSACopyID
  979.     ENDIF
  980.  
  981. ;        OSAComponentFunctionInline(kOSASelectCopyID, 8);
  982. ;        If toID is a reference to kOSANullScript then it is updated to have a
  983. ;        new scriptID value.  This call can be used to perform undo or revert
  984. ;        operations on scripts. 
  985. ;    
  986. ;        Errors:
  987. ;            badComponentInstance    invalid scripting component instance
  988. ;            errOSASystemError
  989. ;            errOSAInvalidID
  990. ;    
  991.  
  992. ; **************************************************************************
  993. ;    OSA Optional GetSource Interface
  994. ;**************************************************************************
  995. ;    Scripting components that support the GetSource interface have the 
  996. ;    kOSASupportsGetSource bit set in it's ComponentDescription.
  997. ;*************************************************************************
  998.  
  999. ;
  1000. ; pascal OSAError OSAGetSource(ComponentInstance scriptingComponent, OSAID scriptID, DescType desiredType, AEDesc *resultingSourceData)
  1001. ;
  1002.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  1003.         Macro
  1004.         _OSAGetSource
  1005.             move.l              #$000C0201,-(sp)
  1006.             moveq               #0,D0
  1007.             dc.w                $A82A
  1008.         EndM
  1009.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1010.         IMPORT_CFM_FUNCTION OSAGetSource
  1011.     ENDIF
  1012.  
  1013. ;        OSAComponentFunctionInline(kOSASelectGetSource, 12);
  1014. ;        This routine causes a compiled script to be output in a form (possibly
  1015. ;        text) such that it is suitable to be passed back to OSACompile.
  1016. ;
  1017. ;        Errors:
  1018. ;            badComponentInstance    invalid scripting component instance
  1019. ;            errOSASystemError
  1020. ;            errOSAInvalidID
  1021. ;            errOSASourceNotAvailable    can't get source for this scriptID
  1022. ;    
  1023.  
  1024. ; **************************************************************************
  1025. ;    OSA Optional AECoercion Interface
  1026. ;**************************************************************************
  1027. ;    Scripting components that support the AECoercion interface have the 
  1028. ;    kOSASupportsAECoercion bit set in it's ComponentDescription.
  1029. ;*************************************************************************
  1030.  
  1031. ;
  1032. ; pascal OSAError OSACoerceFromDesc(ComponentInstance scriptingComponent, const AEDesc *scriptData, long modeFlags, OSAID *resultingScriptID)
  1033. ;
  1034.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  1035.         Macro
  1036.         _OSACoerceFromDesc
  1037.             move.l              #$000C0301,-(sp)
  1038.             moveq               #0,D0
  1039.             dc.w                $A82A
  1040.         EndM
  1041.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1042.         IMPORT_CFM_FUNCTION OSACoerceFromDesc
  1043.     ENDIF
  1044.  
  1045. ;        OSAComponentFunctionInline(kOSASelectCoerceFromDesc, 12);
  1046. ;        This routine causes script data to be coerced into a script value.
  1047. ;        If the scriptData is an AppleEvent, then the resultingScriptID is a
  1048. ;        compiled script ID (mode flags for OSACompile may be used in this case).
  1049. ;        Other scriptData descriptors create script value IDs.
  1050. ;    
  1051. ;        Errors:
  1052. ;            badComponentInstance    invalid scripting component instance
  1053. ;            errOSASystemError
  1054. ;    
  1055. ;        ModeFlags:
  1056. ;            kOSAModePreventGetSource
  1057. ;            kOSAModeCompileIntoContext
  1058. ;            kOSAModeNeverInteract
  1059. ;            kOSAModeCanInteract
  1060. ;            kOSAModeAlwaysInteract
  1061. ;            kOSAModeCantSwitchLayer
  1062. ;            kOSAModeDontReconnect
  1063. ;            kOSAModeDoRecord
  1064. ;    
  1065.  
  1066. ;
  1067. ; pascal OSAError OSACoerceToDesc(ComponentInstance scriptingComponent, OSAID scriptID, DescType desiredType, long modeFlags, AEDesc *result)
  1068. ;
  1069.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  1070.         Macro
  1071.         _OSACoerceToDesc
  1072.             move.l              #$00100302,-(sp)
  1073.             moveq               #0,D0
  1074.             dc.w                $A82A
  1075.         EndM
  1076.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1077.         IMPORT_CFM_FUNCTION OSACoerceToDesc
  1078.     ENDIF
  1079.  
  1080. ;        OSAComponentFunctionInline(kOSASelectCoerceToDesc, 16);
  1081. ;        This routine causes a script value to be coerced into any desired form.
  1082. ;        If the scriptID denotes a compiled script, then it may be coerced to 
  1083. ;        typeAppleEvent.
  1084. ;    
  1085. ;        Errors:
  1086. ;            badComponentInstance    invalid scripting component instance
  1087. ;            errOSASystemError
  1088. ;            errOSAInvalidID
  1089. ;    
  1090.  
  1091. ; **************************************************************************
  1092. ;    OSA Optional AESending Interface
  1093. ;**************************************************************************
  1094. ;    Scripting components that support the AESending interface have the 
  1095. ;    kOSASupportsAESending bit set in it's ComponentDescription.
  1096. ;*************************************************************************
  1097.  
  1098. ;    Scripting systems will supply default values for these procedures if they
  1099. ;    are not set by the client:
  1100. ;
  1101.  
  1102. ;
  1103. ; pascal OSAError OSASetSendProc(ComponentInstance scriptingComponent, OSASendUPP sendProc, long refCon)
  1104. ;
  1105.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  1106.         Macro
  1107.         _OSASetSendProc
  1108.             move.l              #$00080401,-(sp)
  1109.             moveq               #0,D0
  1110.             dc.w                $A82A
  1111.         EndM
  1112.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1113.         IMPORT_CFM_FUNCTION OSASetSendProc
  1114.     ENDIF
  1115.  
  1116. ;        OSAComponentFunctionInline(kOSASelectSetSendProc, 8);
  1117. ;        If sendProc is nil, the default sendProc is used.
  1118. ;    
  1119. ;        Errors:
  1120. ;            badComponentInstance    invalid scripting component instance
  1121. ;            errOSASystemError
  1122. ;    
  1123.  
  1124. ;
  1125. ; pascal OSAError OSAGetSendProc(ComponentInstance scriptingComponent, OSASendUPP *sendProc, long *refCon)
  1126. ;
  1127.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  1128.         Macro
  1129.         _OSAGetSendProc
  1130.             move.l              #$00080402,-(sp)
  1131.             moveq               #0,D0
  1132.             dc.w                $A82A
  1133.         EndM
  1134.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1135.         IMPORT_CFM_FUNCTION OSAGetSendProc
  1136.     ENDIF
  1137.  
  1138. ;        OSAComponentFunctionInline(kOSASelectGetSendProc, 8);
  1139. ;    
  1140. ;        Errors:
  1141. ;            badComponentInstance    invalid scripting component instance
  1142. ;            errOSASystemError
  1143. ;    
  1144.  
  1145. ;
  1146. ; pascal OSAError OSASetCreateProc(ComponentInstance scriptingComponent, OSACreateAppleEventUPP createProc, long refCon)
  1147. ;
  1148.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  1149.         Macro
  1150.         _OSASetCreateProc
  1151.             move.l              #$00080403,-(sp)
  1152.             moveq               #0,D0
  1153.             dc.w                $A82A
  1154.         EndM
  1155.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1156.         IMPORT_CFM_FUNCTION OSASetCreateProc
  1157.     ENDIF
  1158.  
  1159. ;        OSAComponentFunctionInline(kOSASelectSetCreateProc, 8);
  1160. ;        If createProc is nil, the default createProc is used.
  1161. ;    
  1162. ;        Errors:
  1163. ;            badComponentInstance    invalid scripting component instance
  1164. ;            errOSASystemError
  1165. ;    
  1166.  
  1167. ;
  1168. ; pascal OSAError OSAGetCreateProc(ComponentInstance scriptingComponent, OSACreateAppleEventUPP *createProc, long *refCon)
  1169. ;
  1170.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  1171.         Macro
  1172.         _OSAGetCreateProc
  1173.             move.l              #$00080404,-(sp)
  1174.             moveq               #0,D0
  1175.             dc.w                $A82A
  1176.         EndM
  1177.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1178.         IMPORT_CFM_FUNCTION OSAGetCreateProc
  1179.     ENDIF
  1180.  
  1181. ;        OSAComponentFunctionInline(kOSASelectGetCreateProc, 8);
  1182. ;    
  1183. ;        Errors:
  1184. ;            badComponentInstance    invalid scripting component instance
  1185. ;            errOSASystemError
  1186. ;    
  1187.  
  1188. ;
  1189. ; pascal OSAError OSASetDefaultTarget(ComponentInstance scriptingComponent, const AEAddressDesc *target)
  1190. ;
  1191.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  1192.         Macro
  1193.         _OSASetDefaultTarget
  1194.             move.l              #$00040405,-(sp)
  1195.             moveq               #0,D0
  1196.             dc.w                $A82A
  1197.         EndM
  1198.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1199.         IMPORT_CFM_FUNCTION OSASetDefaultTarget
  1200.     ENDIF
  1201.  
  1202. ;        OSAComponentFunctionInline(kOSASelectSetDefaultTarget, 4);
  1203. ;        This routine sets the default target application for AE sending.
  1204. ;        It also establishes the default target from which terminologies come.
  1205. ;        It is effectively like having an AppleScript "tell" statement around
  1206. ;        the entire program.  If this routine is not called, or if the target 
  1207. ;        is a null AEDesc, then the current application is the default target.
  1208. ;    
  1209. ;        Errors:
  1210. ;            badComponentInstance    invalid scripting component instance
  1211. ;            errOSASystemError
  1212. ;    
  1213.  
  1214. ; **************************************************************************
  1215. ;    OSA Optional Recording Interface
  1216. ;**************************************************************************
  1217. ;    Scripting components that support the Recording interface have the 
  1218. ;    kOSASupportsRecording bit set in it's ComponentDescription.
  1219. ;*************************************************************************
  1220.  
  1221. ;
  1222. ; pascal OSAError OSAStartRecording(ComponentInstance scriptingComponent, OSAID *compiledScriptToModifyID)
  1223. ;
  1224.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  1225.         Macro
  1226.         _OSAStartRecording
  1227.             move.l              #$00040501,-(sp)
  1228.             moveq               #0,D0
  1229.             dc.w                $A82A
  1230.         EndM
  1231.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1232.         IMPORT_CFM_FUNCTION OSAStartRecording
  1233.     ENDIF
  1234.  
  1235. ;        OSAComponentFunctionInline(kOSASelectStartRecording, 4);
  1236. ;        Starts recording.  If compiledScriptToModifyID is kOSANullScript, a
  1237. ;        new script ID is created and returned.  If the current application has
  1238. ;        a handler for the kOSARecordedText event, then kOSARecordedText events
  1239. ;        are sent to the application containing the text of each AppleEvent 
  1240. ;        recorded.
  1241. ;    
  1242. ;        Errors:
  1243. ;            badComponentInstance    invalid scripting component instance
  1244. ;            errOSASystemError
  1245. ;            errOSAInvalidID
  1246. ;            errOSARecordingIsAlreadyOn
  1247. ;    
  1248.  
  1249. ;
  1250. ; pascal OSAError OSAStopRecording(ComponentInstance scriptingComponent, OSAID compiledScriptID)
  1251. ;
  1252.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  1253.         Macro
  1254.         _OSAStopRecording
  1255.             move.l              #$00040502,-(sp)
  1256.             moveq               #0,D0
  1257.             dc.w                $A82A
  1258.         EndM
  1259.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1260.         IMPORT_CFM_FUNCTION OSAStopRecording
  1261.     ENDIF
  1262.  
  1263. ;        OSAComponentFunctionInline(kOSASelectStopRecording, 4);
  1264. ;        If compiledScriptID is not being recorded into or recording is not
  1265. ;        currently on, no error is returned.
  1266. ;    
  1267. ;        Errors:
  1268. ;            badComponentInstance    invalid scripting component instance
  1269. ;            errOSASystemError
  1270. ;            errOSAInvalidID
  1271. ;    
  1272.  
  1273. ; **************************************************************************
  1274. ;    OSA Optional Convenience Interface
  1275. ;**************************************************************************
  1276. ;    Scripting components that support the Convenience interface have the 
  1277. ;    kOSASupportsConvenience bit set in it's ComponentDescription.
  1278. ;*************************************************************************
  1279.  
  1280. ;
  1281. ; pascal OSAError OSALoadExecute(ComponentInstance scriptingComponent, const AEDesc *scriptData, OSAID contextID, long modeFlags, OSAID *resultingScriptValueID)
  1282. ;
  1283.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  1284.         Macro
  1285.         _OSALoadExecute
  1286.             move.l              #$00100601,-(sp)
  1287.             moveq               #0,D0
  1288.             dc.w                $A82A
  1289.         EndM
  1290.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1291.         IMPORT_CFM_FUNCTION OSALoadExecute
  1292.     ENDIF
  1293.  
  1294. ;        OSAComponentFunctionInline(kOSASelectLoadExecute, 16);
  1295. ;        This routine is effectively equivalent to calling OSALoad followed by
  1296. ;        OSAExecute.  After execution, the compiled source is disposed.  Only the
  1297. ;        resulting value ID is retained.
  1298. ;    
  1299. ;        Errors:
  1300. ;            badComponentInstance        invalid scripting component instance
  1301. ;            errOSASystemError
  1302. ;            errOSABadStorageType:        scriptData not for this scripting component
  1303. ;            errOSACorruptData:            data seems to be corrupt
  1304. ;            errOSADataFormatObsolete    script data format is no longer supported
  1305. ;            errOSADataFormatTooNew        script data format is from a newer version
  1306. ;            errOSAInvalidID
  1307. ;            errOSAScriptError:            the executing script got an error
  1308. ;    
  1309. ;        ModeFlags:
  1310. ;            kOSAModeNeverInteract
  1311. ;            kOSAModeCanInteract
  1312. ;            kOSAModeAlwaysInteract
  1313. ;            kOSAModeCantSwitchLayer
  1314. ;            kOSAModeDontReconnect
  1315. ;            kOSAModeDoRecord
  1316. ;    
  1317.  
  1318. ;
  1319. ; pascal OSAError OSACompileExecute(ComponentInstance scriptingComponent, const AEDesc *sourceData, OSAID contextID, long modeFlags, OSAID *resultingScriptValueID)
  1320. ;
  1321.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  1322.         Macro
  1323.         _OSACompileExecute
  1324.             move.l              #$00100602,-(sp)
  1325.             moveq               #0,D0
  1326.             dc.w                $A82A
  1327.         EndM
  1328.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1329.         IMPORT_CFM_FUNCTION OSACompileExecute
  1330.     ENDIF
  1331.  
  1332. ;        OSAComponentFunctionInline(kOSASelectCompileExecute, 16);
  1333. ;        This routine is effectively equivalent to calling OSACompile followed by
  1334. ;        OSAExecute.  After execution, the compiled source is disposed.  Only the
  1335. ;        resulting value ID is retained.
  1336. ;    
  1337. ;        Errors:
  1338. ;            badComponentInstance    invalid scripting component instance
  1339. ;            errOSASystemError
  1340. ;            errAECoercionFail:        sourceData is not compilable
  1341. ;            errOSAScriptError:        sourceData was a bad script (syntax error)
  1342. ;            errOSAInvalidID:        previousAndResultingCompiledScriptID was not
  1343. ;                                    valid on input
  1344. ;            errOSAScriptError:        the executing script got an error
  1345. ;    
  1346. ;        ModeFlags:
  1347. ;            kOSAModeNeverInteract
  1348. ;            kOSAModeCanInteract
  1349. ;            kOSAModeAlwaysInteract
  1350. ;            kOSAModeCantSwitchLayer
  1351. ;            kOSAModeDontReconnect
  1352. ;            kOSAModeDoRecord
  1353. ;    
  1354.  
  1355. ;
  1356. ; pascal OSAError OSADoScript(ComponentInstance scriptingComponent, const AEDesc *sourceData, OSAID contextID, DescType desiredType, long modeFlags, AEDesc *resultingText)
  1357. ;
  1358.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  1359.         Macro
  1360.         _OSADoScript
  1361.             move.l              #$00140603,-(sp)
  1362.             moveq               #0,D0
  1363.             dc.w                $A82A
  1364.         EndM
  1365.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1366.         IMPORT_CFM_FUNCTION OSADoScript
  1367.     ENDIF
  1368.  
  1369. ;        OSAComponentFunctionInline(kOSASelectDoScript, 20);
  1370. ;        This routine is effectively equivalent to calling OSACompile followed by
  1371. ;        OSAExecute and then OSADisplay.  After execution, the compiled source
  1372. ;        and the resulting value are is disposed.  Only the resultingText
  1373. ;        descriptor is retained.  If a script error occur during processing, the 
  1374. ;        resultingText gets the error message of the error, and errOSAScriptError
  1375. ;        is returned.  OSAScriptError may still be used to extract more 
  1376. ;        information about the particular error.
  1377. ;    
  1378. ;        Errors:
  1379. ;            badComponentInstance    invalid scripting component instance
  1380. ;            errOSASystemError
  1381. ;            errAECoercionFail:        sourceData is not compilable or 
  1382. ;                                    desiredType not supported by scripting component
  1383. ;            errOSAScriptError:        sourceData was a bad script (syntax error)
  1384. ;            errOSAInvalidID:        previousAndResultingCompiledScriptID was not
  1385. ;                                    valid on input
  1386. ;            errOSAScriptError:        the executing script got an error
  1387. ;    
  1388. ;        ModeFlags:
  1389. ;            kOSAModeNeverInteract
  1390. ;            kOSAModeCanInteract
  1391. ;            kOSAModeAlwaysInteract
  1392. ;            kOSAModeCantSwitchLayer
  1393. ;            kOSAModeDontReconnect
  1394. ;            kOSAModeDoRecord
  1395. ;            kOSAModeDisplayForHumans
  1396. ;    
  1397.  
  1398. ; **************************************************************************
  1399. ;    OSA Optional Dialects Interface
  1400. ;**************************************************************************
  1401. ;    Scripting components that support the Dialects interface have the 
  1402. ;    kOSASupportsDialects bit set in it's ComponentDescription.
  1403. ;*************************************************************************
  1404.  
  1405. ;    These calls allows an scripting component that supports different dialects
  1406. ;    to dynamically switch between those dialects.  Although this interface is
  1407. ;    specified, the particular dialect codes are scripting component dependent.
  1408. ;
  1409.  
  1410. ;
  1411. ; pascal OSAError OSASetCurrentDialect(ComponentInstance scriptingComponent, short dialectCode)
  1412. ;
  1413.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  1414.         Macro
  1415.         _OSASetCurrentDialect
  1416.             move.l              #$00020701,-(sp)
  1417.             moveq               #0,D0
  1418.             dc.w                $A82A
  1419.         EndM
  1420.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1421.         IMPORT_CFM_FUNCTION OSASetCurrentDialect
  1422.     ENDIF
  1423.  
  1424. ;        OSAComponentFunctionInline(kOSASelectSetCurrentDialect, 2);
  1425. ;    
  1426. ;        Errors:
  1427. ;            badComponentInstance    invalid scripting component instance
  1428. ;            errOSASystemError
  1429. ;            errOSANoSuchDialect:    invalid dialectCode
  1430. ;    
  1431.  
  1432. ;
  1433. ; pascal OSAError OSAGetCurrentDialect(ComponentInstance scriptingComponent, short *resultingDialectCode)
  1434. ;
  1435.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  1436.         Macro
  1437.         _OSAGetCurrentDialect
  1438.             move.l              #$00040702,-(sp)
  1439.             moveq               #0,D0
  1440.             dc.w                $A82A
  1441.         EndM
  1442.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1443.         IMPORT_CFM_FUNCTION OSAGetCurrentDialect
  1444.     ENDIF
  1445.  
  1446. ;        OSAComponentFunctionInline(kOSASelectGetCurrentDialect, 4);
  1447. ;    
  1448. ;        Errors:
  1449. ;            badComponentInstance    invalid scripting component instance
  1450. ;            errOSASystemError
  1451. ;    
  1452.  
  1453. ;
  1454. ; pascal OSAError OSAAvailableDialects(ComponentInstance scriptingComponent, AEDesc *resultingDialectInfoList)
  1455. ;
  1456.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  1457.         Macro
  1458.         _OSAAvailableDialects
  1459.             move.l              #$00040703,-(sp)
  1460.             moveq               #0,D0
  1461.             dc.w                $A82A
  1462.         EndM
  1463.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1464.         IMPORT_CFM_FUNCTION OSAAvailableDialects
  1465.     ENDIF
  1466.  
  1467. ;        OSAComponentFunctionInline(kOSASelectAvailableDialects, 4);
  1468. ;        This call return an AEList containing information about each of the
  1469. ;        currently available dialects of a scripting component.  Each item
  1470. ;        is an AERecord of typeOSADialectInfo that contains at least the fields
  1471. ;        keyOSADialectName, keyOSADialectCode, KeyOSADialectLangCode and 
  1472. ;        keyOSADialectScriptCode.
  1473. ;    
  1474. ;        Errors:
  1475. ;            badComponentInstance    invalid scripting component instance
  1476. ;            errOSASystemError
  1477. ;    
  1478.  
  1479. ;
  1480. ; pascal OSAError OSAGetDialectInfo(ComponentInstance scriptingComponent, short dialectCode, OSType selector, AEDesc *resultingDialectInfo)
  1481. ;
  1482.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  1483.         Macro
  1484.         _OSAGetDialectInfo
  1485.             move.l              #$000A0704,-(sp)
  1486.             moveq               #0,D0
  1487.             dc.w                $A82A
  1488.         EndM
  1489.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1490.         IMPORT_CFM_FUNCTION OSAGetDialectInfo
  1491.     ENDIF
  1492.  
  1493. ;        OSAComponentFunctionInline(kOSASelectGetDialectInfo, 10);
  1494. ;        This call gives information about the specified dialect of a scripting
  1495. ;        component. It returns an AEDesc whose type depends on the selector 
  1496. ;        specified. Available selectors are the same as the field keys for a
  1497. ;        dialect info record. The type of AEDesc returned is the same as the 
  1498. ;        type of the field that has same key as the selector.
  1499. ;    
  1500. ;        Errors:
  1501. ;            badComponentInstance    invalid scripting component instance
  1502. ;            errOSASystemError
  1503. ;             errOSABadSelector
  1504. ;            errOSANoSuchDialect:    invalid dialectCode
  1505. ;    
  1506.  
  1507. ;
  1508. ; pascal OSAError OSAAvailableDialectCodeList(ComponentInstance scriptingComponent, AEDesc *resultingDialectCodeList)
  1509. ;
  1510.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  1511.         Macro
  1512.         _OSAAvailableDialectCodeList
  1513.             move.l              #$00040705,-(sp)
  1514.             moveq               #0,D0
  1515.             dc.w                $A82A
  1516.         EndM
  1517.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1518.         IMPORT_CFM_FUNCTION OSAAvailableDialectCodeList
  1519.     ENDIF
  1520.  
  1521. ;        OSAComponentFunctionInline(kOSASelectAvailableDialectCodeList, 4);
  1522. ;        This is alternative to OSAGetAvailableDialectCodeList. Use this call
  1523. ;        and  OSAGetDialectInfo to get information on dialects.
  1524. ;        This call return an AEList containing dialect code for each of the
  1525. ;        currently available dialects of a scripting component. Each dialect
  1526. ;        code is a short integer of type typeShortInteger.
  1527. ;    
  1528. ;        Errors:
  1529. ;            badComponentInstance    invalid scripting component instance
  1530. ;            errOSASystemError
  1531. ;
  1532. ;        Type of a dialect info record containing at least keyOSADialectName
  1533. ;        and keyOSADialectCode fields.
  1534. ;
  1535. ;        keys for dialect info record, also used as selectors to OSAGetDialectInfo.
  1536. ;
  1537. ;        Field of a typeOSADialectInfo record of typeChar.
  1538. ;        Field of a typeOSADialectInfo record of typeShortInteger.
  1539. ;        Field of a typeOSADialectInfo record of typeShortInteger.
  1540. ;        Field of a typeOSADialectInfo record of typeShortInteger.
  1541. ;    
  1542.  
  1543. ; **************************************************************************
  1544. ;    OSA Optional Event Handling Interface
  1545. ;**************************************************************************
  1546. ;    Scripting components that support the Event Handling interface have the 
  1547. ;    kOSASupportsEventHandling bit set in it's ComponentDescription.
  1548. ;*************************************************************************
  1549.  
  1550. ;
  1551. ; pascal OSAError OSASetResumeDispatchProc(ComponentInstance scriptingComponent, AEEventHandlerUPP resumeDispatchProc, long refCon)
  1552. ;
  1553.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  1554.         Macro
  1555.         _OSASetResumeDispatchProc
  1556.             move.l              #$00080801,-(sp)
  1557.             moveq               #0,D0
  1558.             dc.w                $A82A
  1559.         EndM
  1560.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1561.         IMPORT_CFM_FUNCTION OSASetResumeDispatchProc
  1562.     ENDIF
  1563.  
  1564. ;        OSAComponentFunctionInline(kOSASelectSetResumeDispatchProc, 8);
  1565. ;        This function is used to set the ResumeDispatchProc that will be used
  1566. ;        by OSAExecuteEvent and OSADoEvent if either no event handler can be
  1567. ;        found in the context, or the context event hander "continues" control
  1568. ;        onward. The two constants kOSAUseStandardDispatch and kOSANoDispatch
  1569. ;        may also be passed to this routine indicating that the handler registered
  1570. ;        in the application with AEInstallEventHandler should be used, or no
  1571. ;        dispatch should occur, respectively.
  1572. ;    
  1573. ;        Errors:
  1574. ;            badComponentInstance    invalid scripting component instance
  1575. ;            errOSASystemError
  1576. ;    
  1577.  
  1578.  
  1579. kOSAUseStandardDispatch            EQU        $FFFFFFFF
  1580. ;        Special ResumeDispatchProc constant which may be passed to 
  1581. ;        OSASetResumeDispatchProc indicating that the handler registered
  1582. ;        in the application with AEInstallEventHandler should be used.
  1583. ;        
  1584. ;        NOTE:    Had to remove the cast (AEEventHandlerUPP).  The C compiler
  1585. ;                doesn't allow pointer types to be assigned to an enum.  All
  1586. ;                constants must be assigned as enums to translate properly to
  1587. ;                Pascal.
  1588. ;    
  1589.  
  1590.  
  1591. kOSANoDispatch                    EQU        0
  1592. ;        Special ResumeDispatchProc constant which may be passed to 
  1593. ;        OSASetResumeDispatchProc indicating that no dispatch should occur.
  1594. ;        
  1595. ;        NOTE:    Had to remove the cast (AEEventHandlerUPP).  The C compiler
  1596. ;                doesn't allow pointer types to be assigned to an enum.  All
  1597. ;                constants must be assigned as enums to translate properly to
  1598. ;                Pascal.
  1599. ;    
  1600.  
  1601.  
  1602. kOSADontUsePhac                    EQU        $0001
  1603. ;        Special refCon constant that may be given to OSASetResumeDispatchProc
  1604. ;        only when kOSAUseStandardDispatch is used as the ResumeDispatchProc.
  1605. ;        This causes the standard dispatch to be performed, except the phac
  1606. ;        handler is not called.  This is useful during tinkerability, when
  1607. ;        the phac handler is used to lookup a context associated with an event's 
  1608. ;        direct parameter, and call OSAExecuteEvent or OSADoEvent.  Failure to
  1609. ;        bypass the phac handler would result in an infinite loop.
  1610. ;    
  1611.  
  1612. ;
  1613. ; pascal OSAError OSAGetResumeDispatchProc(ComponentInstance scriptingComponent, AEEventHandlerUPP *resumeDispatchProc, long *refCon)
  1614. ;
  1615.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  1616.         Macro
  1617.         _OSAGetResumeDispatchProc
  1618.             move.l              #$00080802,-(sp)
  1619.             moveq               #0,D0
  1620.             dc.w                $A82A
  1621.         EndM
  1622.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1623.         IMPORT_CFM_FUNCTION OSAGetResumeDispatchProc
  1624.     ENDIF
  1625.  
  1626. ;        OSAComponentFunctionInline(kOSASelectGetResumeDispatchProc, 8);
  1627. ;        Returns the registered ResumeDispatchProc.  If no ResumeDispatchProc has
  1628. ;        been registered, then kOSAUseStandardDispatch (the default) is returned.
  1629. ;    
  1630. ;        Errors:
  1631. ;            badComponentInstance    invalid scripting component instance
  1632. ;            errOSASystemError
  1633. ;    
  1634.  
  1635. ;
  1636. ; pascal OSAError OSAExecuteEvent(ComponentInstance scriptingComponent, const AppleEvent *theAppleEvent, OSAID contextID, long modeFlags, OSAID *resultingScriptValueID)
  1637. ;
  1638.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  1639.         Macro
  1640.         _OSAExecuteEvent
  1641.             move.l              #$00100803,-(sp)
  1642.             moveq               #0,D0
  1643.             dc.w                $A82A
  1644.         EndM
  1645.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1646.         IMPORT_CFM_FUNCTION OSAExecuteEvent
  1647.     ENDIF
  1648.  
  1649. ;        OSAComponentFunctionInline(kOSASelectExecuteEvent, 16);
  1650. ;        This call is similar to OSAExecute except the initial command to
  1651. ;        execute comes in the form of an AppleEvent.  If the contextID
  1652. ;        defines any event handlers for that event, they are used to process
  1653. ;        the event.  If no event handler can be found in the context
  1654. ;        errAEEventNotHandled is returned.  If an event handler is found and
  1655. ;        the hander "continues" control onward, the ResumeDispatchProc
  1656. ;        (registered with OSASetResumeDispatchProc, above) is called given the
  1657. ;        AppleEvent.  The result is returned as a scriptValueID.
  1658. ;    
  1659. ;        Errors:
  1660. ;            badComponentInstance    invalid scripting component instance
  1661. ;            errOSASystemError
  1662. ;            errOSAInvalidID
  1663. ;            errOSAScriptError:        the executing script got an error
  1664. ;            errAEEventNotHandled:    no handler for event in contextID
  1665. ;    
  1666. ;        ModeFlags:
  1667. ;            kOSAModeNeverInteract
  1668. ;            kOSAModeCanInteract
  1669. ;            kOSAModeAlwaysInteract
  1670. ;            kOSAModeCantSwitchLayer
  1671. ;            kOSAModeDontReconnect
  1672. ;            kOSAModeDoRecord
  1673. ;    
  1674.  
  1675. ;
  1676. ; pascal OSAError OSADoEvent(ComponentInstance scriptingComponent, const AppleEvent *theAppleEvent, OSAID contextID, long modeFlags, AppleEvent *reply)
  1677. ;
  1678.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  1679.         Macro
  1680.         _OSADoEvent
  1681.             move.l              #$00100804,-(sp)
  1682.             moveq               #0,D0
  1683.             dc.w                $A82A
  1684.         EndM
  1685.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1686.         IMPORT_CFM_FUNCTION OSADoEvent
  1687.     ENDIF
  1688.  
  1689. ;        OSAComponentFunctionInline(kOSASelectDoEvent, 16);
  1690. ;        This call is similar to OSADoScript except the initial command to
  1691. ;        execute comes in the form of an AppleEvent, and the result is an 
  1692. ;        AppleEvent reply record.  If the contextID defines any event handlers
  1693. ;        for that event, they are used to process the event.  If no event handler
  1694. ;        can be found in the context errAEEventNotHandled is returned.  If an
  1695. ;        event handler is found and the hander "continues" control onward, the
  1696. ;        ResumeDispatchProc (registered with OSASetResumeDispatchProc, above) is
  1697. ;        called given the AppleEvent.  The result is returned in the form of an
  1698. ;        AppleEvent reply descriptor. If at any time the script gets an error, or
  1699. ;        if the ResumeDispatchProc returns a reply event indicating an error,
  1700. ;        then the OSADoEvent call itself returns an error reply (i.e. OSADoEvent
  1701. ;        should never return errOSAScriptError).  Any error result returned by
  1702. ;        the ResumeDispatchProc will be returned by OSADoEvent.
  1703. ;    
  1704. ;        Errors:
  1705. ;            badComponentInstance    invalid scripting component instance
  1706. ;            errOSASystemError
  1707. ;            errOSAInvalidID
  1708. ;            errAEEventNotHandled:    no handler for event in contextID
  1709. ;    
  1710. ;        ModeFlags:
  1711. ;            kOSAModeNeverInteract
  1712. ;            kOSAModeCanInteract
  1713. ;            kOSAModeAlwaysInteract
  1714. ;            kOSAModeCantSwitchLayer
  1715. ;            kOSAModeDontReconnect
  1716. ;            kOSAModeDoRecord
  1717. ;    
  1718.  
  1719. ;
  1720. ; pascal OSAError OSAMakeContext(ComponentInstance scriptingComponent, const AEDesc *contextName, OSAID parentContext, OSAID *resultingContextID)
  1721. ;
  1722.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  1723.         Macro
  1724.         _OSAMakeContext
  1725.             move.l              #$000C0805,-(sp)
  1726.             moveq               #0,D0
  1727.             dc.w                $A82A
  1728.         EndM
  1729.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1730.         IMPORT_CFM_FUNCTION OSAMakeContext
  1731.     ENDIF
  1732.  
  1733. ;        OSAComponentFunctionInline(kOSASelectMakeContext, 12);
  1734. ;        Makes a new empty context which may be passed to OSAExecute or 
  1735. ;        OSAExecuteEvent.  If contextName is typeNull, an unnamed context is
  1736. ;        created. If parentContext is kOSANullScript then the resulting context
  1737. ;        does not inherit bindings from any other context.
  1738. ;    
  1739. ;        Errors:
  1740. ;            badComponentInstance    invalid scripting component instance
  1741. ;            errOSASystemError
  1742. ;            errOSAInvalidID
  1743. ;            errAECoercionFail:        contextName is invalid
  1744. ;    
  1745.  
  1746.  
  1747.     ENDIF ; __OSA__ 
  1748.  
  1749.